package com.zhaowb.springcloud.admin.mapper;

import com.zhaowb.springcloud.admin.entity.Menu;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * Created with IDEA
 *
 * @author zhaowb
 * @date 2018/11/1 10:17
 */
@Repository
public interface MenuMapper extends Mapper<Menu> {

    /**
     * 根据权限id和权限类型查找用户可访问菜单
     *
     * @param authorityId   权限id
     * @param authorityType 权限类型
     * @return
     */
    List<Menu> selectMenuByAuthorityId(@Param("authorityId") String authorityId, String authorityType);

    /**
     * 根据用户和组的权限关系查找用户可访问菜单
     *
     * @param userId 用户id
     * @return
     */
    List<Menu> selectAuthorityMenuByUserId(@Param("userId") int userId);

    /**
     * 根据用户和组的权限关系查找用户可访问的系统
     *
     * @param userId 用户id
     * @return
     */
    List<Menu> selectAuthoritySystemByUserId(@Param("userId") int userId);
}